#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>
#include<stdlib.h>
int* sockCollocation(int* sockets, int socketsSize, int* returnSize) {
    int ret = 0;
    int i = 0;
    for (i = 0; i < socketsSize; i++)
    {
        ret ^= sockets[i];
    }
    int pos = 0;
    for (i = 0; i < 32; i++)
    {
        if (((ret >> i) & 1) == 1)
        {
            pos = i;
            break;
        }
    }
    int a = 0;
    int a1 = 0;
    for (i = 0; i < socketsSize; i++)
    {
        if (((sockets[i] >> pos) & 1) == 1)
        {
            a ^= sockets[i];
        }
    }
    a1 = ret ^ a;
    returnSize = (int*)malloc(10 * sizeof(int));

    *returnSize = a1;
    *(returnSize + 1) = a;
    return returnSize;
}

int main()
{
    int arr[] = { 4,5,2,4,6,6 };
    int sz = 6;
    int* arr1=NULL;
    int* ret = sockCollocation(arr, sz, arr1);
    int i = 0;
    for (i = 0; i < 2; i++)
    {
        printf("%d ", ret[i]);
    }
    return 0;
}